//
//  DDDiscoverJobFinderCell.m
//  DingDongZP
//
//  Created by Jyh on 16/4/10.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

#import "DDDiscoverJobFinderCell.h"

@implementation DDDiscoverJobFinderCell

- (void)awakeFromNib {
    // Initialization code
    self.mainBgView.layer.cornerRadius = 5;
    self.mainBgView.layer.masksToBounds = YES;
    self.avatarImageView.layer.cornerRadius = CGRectGetWidth(self.avatarImageView.frame)/2;
    self.avatarImageView.layer.masksToBounds = YES;
    
    self.jobNameLabel.text = @"";
    self.wageLabel.text = @"";
    self.cityLabel.text = @"";
    self.experienceLabel.text = @"";
    self.educationLabel.text = @"";
    self.personInfoLabel.text = @"";
    self.jobStatusLabel.text = @"";
    
    [self.voiceStatusBtn setTitle:@"  文字简历" forState:UIControlStateNormal];
    [self.voiceStatusBtn setTitle:@"  语音简历" forState:UIControlStateSelected];
    
    [self.voiceStatusBtn setImage:[UIImage imageNamed:@"common_text"] forState:UIControlStateNormal];
    [self.voiceStatusBtn setImage:[UIImage imageNamed:@"common_voice"] forState:UIControlStateSelected];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (void)updateViewWithData:(DDJobfinderDetail *)detail
{
    if (detail) {
//        [self.avatarImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",kImagePre,detail.logo]] placeholderImage:[UIImage imageNamed:@"common_avatar"]];
        [self.avatarImageView sd_setImageWithURL:[NSURL URLWithString:[DDAPIGenerate imageURLWithPath:detail.logo]] placeholderImage:[UIImage imageNamed:@"common_avatar"]];
        
        self.jobNameLabel.text = detail.expectjobtitle ? detail.expectjobtitle:@"";
        if (detail.expectsalary) {
            self.wageLabel.text = [NSString stringWithFormat:@"￥%@",detail.expectsalary ? detail.expectsalary:@"薪资"];
        }
        
        self.cityLabel.text = detail.expectcity ? detail.expectcity:@"";
        self.experienceLabel.text = detail.experience ? detail.experience:@"";
        self.educationLabel.text = detail.edu ? detail.edu : @"";
        
//        NSMutableArray *tempArray = [@[] mutableCopy];
        
//        if ([detail.name length] > 1) {
//            
//            [tempArray addObject:detail.name];
//        }
//        if ([detail.sex length] > 1) {
//            
//            [tempArray addObject:detail.sex];
//        }
        
//        if (tempArray.count > 0) {
//            
//            NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc]initWithString:[tempArray componentsJoinedByString:@"|"]];
//            [attributedStr addAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName:COLOR_FONT_LIGHT_GREEN} range:NSMakeRange(0, [detail.name length])];
//            
//            [attributedStr addAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14], NSForegroundColorAttributeName:COLOR_FONT_DARK_GRAY} range:NSMakeRange([detail.name length],[attributedStr length]- [detail.name length])];
//            
//            self.personInfoLabel.attributedText = attributedStr;
//        }
        
        self.personInfoLabel.text =  [NSString stringWithFormat:@"%@ | %@",!detail.name ? @"未填写":detail.name,!detail.sex ? @"未填写":detail.sex];
        self.jobStatusLabel.text = detail.status? detail.status : @"";
        
        if ([detail.isresumeaudio isEqualToString:@"1"]) {
            
            self.voiceStatusBtn.selected = true;
        } else {
            
            self.voiceStatusBtn.selected = false;
        }
        
//        self.sortIntroductionLabel.text = detail.mystrengthstext ? detail.mystrengthstext:@"";
    }
}

@end
